package com.situ.mall.clone;

import org.junit.jupiter.api.Test;

public class Deom {

    public static void main1(String[] args) {
        Person p1 = new Person(18);
        Person p2 = p1;
        p2.age = 20;

        System.out.println(p1 == p2);//true
        System.out.println(p1.age);//20
    }

    public static void main(String[] args) {
        Person p1 = new Person(18);
        Person p2 = p1.clone();
        p2.age = 20;
        p2.arr[0] = 10;

        System.out.println(p1 == p2);//false
        System.out.println(p1.age);//18
        System.out.println(p1.arr[0]);//10
    }

    @Test
    public void test1() {
        final String str = "java";
        //str = "c++";
        System.out.println(str);//c++
    }

    @Test
    public void test2() {
        final int[] array = {1, 2};
        // array = new int[]{2, 5};
        array[0] = 4;
        System.out.println(array[0]);
    }
}
